package com.xyazm.market.domain.param;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 计算订单费用
 * @author xuyou
 * @date 2022年04月20日 21:56
 */
@Data
public class CalculateOrderAmountParam implements Serializable {

    @ApiModelProperty(value = "订单号")
    private String orderId;

    @ApiModelProperty(value = "用户id")
    private String userId;

    @ApiModelProperty(value = "卖家id")
    private String sellerId;

    @ApiModelProperty(value = "优惠券id")
    private String couponId;

    @ApiModelProperty(value = "区域id")
    private String regionId;


    /**
     *  订单条目信息
     */
    @NotEmpty(message = "订单条目信息不能为空")
    private List<OrderItemParam> orderItemParamList;
    /**
     * 订单费用信息
     */
    @NotEmpty(message = "订单费用信息不能为空")
    private List<OrderAmountParam> orderAmountParamList;


    /**
     * 订单条目信息
     */
    @Data
    public static class OrderItemParam implements Serializable {

        private static final long serialVersionUID = 8267460170612816097L;
        /**
         * 商品编号
         */
        @NotEmpty(message = "商品编号不能为空")
        private String productId;
        /**
         * 商品类型 1:普通商品,2:预售商品
         */
        @NotNull(message = "商品类型不能为空")
        private Integer productType;
        /**
         * sku编号
         */
        @NotEmpty(message = "sku编号不能为空")
        private String skuCode;
        /**
         * 商品销售价格
        */
        @NotNull(message = "商品销售价格不能为空")
        private Integer salePrice;
        /**
         * 销售数量
         */
        @NotNull(message = "销售数量不能为空")
        private Integer saleQuantity;

    }

    /**
     * 订单费用信息
     */
    @Data
    public static class OrderAmountParam implements Serializable {

        private static final long serialVersionUID = -8189987703740512851L;
        /**
         * 费用类型
         */
        @NotNull(message = "费用类型不能为空")
        private Integer amountType;
        /**
         * 费用金额
         */
        @NotNull(message = "费用金额不能为空")
        private Integer amount;
    }


}
